package org.reenscape.packet;
import org.reenscape.model.*;
import org.reenscape.updater.*;
import org.reenscape.lib.*;
import org.reenscape.skill.*;
public class PacketButton {


			/**
			* Clicking almost anything in the game menus or pop up interfaces is handled here.
			*/
						public void ActionButton(PacketParser p3){
							int ID = MiscUtil.HexToInt(p3.inStream.buffer, 0, p3.packetSize);
							
							switch(ID){				
								case 9154:
								if(p3.LogoutTimer >= 0){
									p3.sendMessage("You have to wait 10 seconds of not being in combat before you can logout.");
								} else {
									p3.logout();
								}
								break;
								
								case 14067: // Character Design Screen Accept Button
								p3.RemoveAllWindows();
								break;
								
								case 9157:
								p3.sendFrame126("Please wait...", 2461);
								p3.RemoveAllWindows();
								Skill.fletching.MakeBow(p3.bow, 0, p3);
								p3.NpcDialogueSend = false;
								break;
								
								case 9158:
								p3.sendFrame126("Please wait...", 2462);
								p3.RemoveAllWindows();
								Skill.fletching.MakeBow(p3.bow, 1, p3);
								p3.NpcDialogueSend = false;
								break;
						    
								case 13092:
									if(p3.tradeWith > 0) {
										if(ClientUpdater.players[p3.tradeWith].tradeStatus == 2) {
											p3.tradeStatus = 3;
											p3.sendFrame126("Waiting for other player...", 3431);
										} else if(ClientUpdater.players[p3.tradeWith].tradeStatus == 3) {
											p3.tradeStatus = 3;
										}
									}
								break;
								
								case 13218:
									if(p3.tradeWith > 0) {
										if(ClientUpdater.players[p3.tradeWith].tradeStatus == 3) {
											p3.tradeStatus = 4;
											p3.sendFrame126("Waiting for other player...", 3535);
										} else if(ClientUpdater.players[p3.tradeWith].tradeStatus == 4) {
											p3.tradeStatus = 4;
										}
									}
								break;
								
								case 168:/*YES*/		p3.Animation(0x357);		break;
								case 169:/*NO*/		p3.Animation(0x358);		break;
								case 162:/*THINK*/	p3.Animation(0x359);		break;
								case 164:/*BOW*/		p3.Animation(0x35A);		break;
								case 165:/*ANGRY*/	p3.Animation(0x35B);		break;
								case 161:/*CRY*/		p3.Animation(0x35C);		break;
								case 170:/*LAUGH*/	p3.Animation(0x35D);		break;
								case 171:/*CHEER*/	p3.Animation(0x35E);		break;
								case 163:/*WAVE*/	p3.Animation(0x35F);		break;
								case 167:/*BECKON*/	p3.Animation(0x360);		break;
								case 172:/*CLAP*/		p3.Animation(0x361);		break;
								case 166:/*DANCE*/	p3.Animation(0x362);		break;
								case 52050:/*PANIC*/	p3.Animation(0x839);		break;
								case 52051:/*JIG*/	p3.Animation(0x83A);		break;
								case 52052:/*SPIN*/	p3.Animation(0x83B);		break;
								case 52053:/*HEAD*/	p3.Animation(0x83C);		break;
								case 52054:/*JUMP*/	p3.Animation(0x83D);		break;
								case 52055:/*RASP*/	p3.Animation(0x83E);		break;
								case 52056:/*YAWN*/	p3.Animation(0x83F);		break;
								case 52057:/*SALUTE*/	p3.Animation(0x840);		break;
								case 52058:/*SHRUG*/	p3.Animation(0x841);		break;
								case 43092:/*BLOW*/	p3.Animation(0x558);		break;
								
								//Weapon fight type selections
								case 9125:/*ACCURATE*/		case 22228:/*PUNCH - UNARMED*/
									p3.FightType = 1;
									p3.SkillID = 0;
								break;

								case 48010:/*FLICK - WHIP*/		case 21200:/*SPIKE - PICKAXE*/
								case 1080:/*BASH - STAFFS*/		case 6168:/*CHOP - AXE*/
								case 6236:/*ACCUR. L BOW*/		case 17102:/*ACCURATE - DARTS*/
								case 8234:/*STAB - DAGGER*/
									p3.FightType = 1;
									p3.SkillID = 0;
								break;

								case 9126:/*DEFENSIVE*/		case 48008:/*WHIP DEFLECT*/
								case 22229:/*UNARMED BLOCK*/	case 21201:/*PICKAXE BLOCK*/
								case 1078:/*STAFF BLOCK*/		case 6169:/*AXE BLOCK*/
								case 33019:/*HALBERD FEND*/	case 18078:/*SPEAR BLOCK*/
								case 8235:/*DAGGER BLOCK*/
									p3.FightType = 4;
									p3.SkillID = 1;
								break;        
        
								case 3014:/*SCYTHE REAP*/
									p3.FightType = 1;
									p3.SkillID = 1;
								break;

								case 3017:/*CHOP SCYTHE*/
									p3.FightType = 2;
									p3.SkillID = 2;
								break;

								case 3016:/*JAB SCYTHE*/
									p3.FightType = 3;
									p3.SkillID = 2;
								break;

								case 3015:/*BLOCK SCYTHE*/
									p3.FightType = 4;
									p3.SkillID = 3;
								break;
        
								case 9127:/*CONTROLLED*/		case 48009:/*WHIP LASH*/
								case 33018:/*HALBERD JAB*/		case 6234:/*LBOW LONGRNG*/
								case 18077:/*LUNGE SPEAR*/		case 18080:/*SWIPE SPEAR*/
								case 18079:/*POUND SPEAR*/		case 17100:/*DARTS LRANGE*/
									p3.FightType = 3;
									p3.SkillID = 3;
								break;

								case 9128:/*AGGRESSIVE*/		case 22230:/*UNARMED KICK*/
								case 21203:/*PICK IMPALE*/		case 21202:/*PICK SMASH*/
								case 1079:/*STAFF POUND*/		case 6171:/*AXE HACK*/
								case 6170:/*AXE SMASH*/		case 33020:/*HALBERD SWIPE*/
								case 6235:/*LBOW RAPID*/		case 17101:/*RAPID DARTS*/
								case 8236:/*DAGGER SLASH*/
									p3.FightType = 2;
									p3.SkillID = 2;
								break;
								
								case 153:
									if(p3.playerEnergy > 0) p3.isRunning2 = true;
									if(p3.playerEnergy == 0) {
										p3.sendMessage("You don't have enough energy left to run!");
										p3.isRunning2 = false;
									}
								break;
								
								case 152:
									p3.isRunning2 = false;
								break;
								
								default:
								System.out.println("["+p3.playerName+"-"+p3.playerId+"] Packet 185 ActionButton: "+ID);
								break;
							}
						}
}